<template>
  <head-top :loading="loading" :is_footer_mar="false">
    <view class="bj_img">
      <u-image src="@/static/tabs/mybg.png" height="500rpx" :lazy-load="true" width="750rpx"></u-image>
    </view>
    <view class="my_container">
      <view class="my_con"> 个人中心 </view>
      <view class="user_head">
        <!-- <view>
          <u-image src="@/static/tabs/buku2.png" radius="50%" height="132rpx" :lazy-load="true" width="132rpx"></u-image>
        </view> -->
        <button class="avatar-wrapper" :style="{ border: 'none', height: '135rpx', width: '135rpx', borderRadius: '50%' }"
          open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
          <u-image src="@/static/tabs/buku2.png" radius="50%" height="135rpx" :lazy-load="true" width="135rpx"></u-image>
        </button>
        <view class="user_name">爸爸的爸爸叫什么</view>
      </view>
      <view class="contant_list">
        <view class="contant_list_title">
          <view>
            <text>积分</text>
            <text class="bold">888</text>
          </view>
          <view>
            <text>可提现</text>
            <text class="bold">888</text>
          </view>
          <view @click="Balance">
            <text>我的余额</text>
            <text class="bold">888</text>
          </view>
        </view>
        <!-- <view class="img_user" :style="styleUseImg">
          <u-image src="@/static/tabs/userBg.png" :lazy-load="true" width="690rpx" height="116rpx"></u-image>
          <view class="img_list">
            <view class="img_list_item" v-for="i in 3" :key="i">
              <view class="yanse">1000</view>
              <view>福袋</view>
            </view>
          </view>
        </view> -->
      </view>
      <BmyOrder :list="orderList" title="我的订单" nextPage="../../subPage/order/order?type=0"></BmyOrder>
      <view style="padding-top: 30rpx;">
        <BmyOrder title="我的申请" islot nextPage="../../pages/myblessing/index">
          <BshareList :isPadding="false"></BshareList>
        </BmyOrder>
      </view>
      <view style="padding-top: 30rpx;">
        <BmyOrder @change="change" :list="settleList" :ismore="false" :isMsg="false" title="我的服务"></BmyOrder>
      </view>
      <!-- <BList></BList> -->
    </view>
  </head-top>
</template>
<script lang="ts" setup>
import { ref, onMounted, getCurrentInstance, reactive, computed } from "vue";
import { setApiData, UpNewloadImg } from '@/hooks'
import BList from '@/components/BList/index.vue'
import BmyOrder from '@/components/BmyOrder/index.vue'
import BshareList from '@/components/BshareList/BshareList.vue'
import bg_user from '@/static/tabs/userBg.png'
// 我的订单
import daifahuo from '@/static/tabs/daifahuo.png'
import daishouk from '@/static/tabs/daishouk.png'
import daishouhu from '@/static/tabs/daishouhu.png'
import daipl from '@/static/tabs/daipl.png'
import shouhou from '@/static/tabs/shouhou.png'
const loading = ref<boolean>(false)
const orderList = reactive([
  {
    name: '待付款',
    img: daishouk,
    path: '../../subPage/order/order?type=1',
    value: ''
  }, {
    name: '待发货',
    img: daifahuo,
    path: '../../subPage/order/order?type=2',
    value: 9,
  },
  {
    name: '待收货',
    img: daishouhu,
    path: '../../subPage/order/order?type=3',
    value: 99,
  },
  {
    name: '待评价',
    img: daipl,
    path: '../../subPage/evaluated/evaluated?type=1',
    value: ''
  },
  {
    name: '售后',
    img: shouhou,
    path: '../../subPage/evaluated/evaluated?type=2',
    value: ''
  }
])
// 我的服务
import address from '@/static/tabs/address.png'
import feedback from '@/static/tabs/feedback.png'
import settle from '@/static/tabs/settle.png'

const settleList = reactive([
  {
    name: '收货地址',
    img: address,
    path: '../../subPage/addarea/addarea'
  },
  {
    name: '问题反馈',
    img: feedback,
    path: '../../subPage/feeback/feeback'
  },
  {
    name: '我要开店',
    img: settle,
    path: ''
  }
])
const user = reactive({
  avatar: "",
  nick_name: "",
  member_no: "",
});
function change(Node) {
  console.log(Node, 'node')
}
function Balance() {
  uni.navigateTo({
    url: '../../subPage/Balance/Balance'
  })
}
const { filePath, uloadImg_ } = UpNewloadImg()

const onChooseAvatar = (async (e) => {
  filePath.value = e.detail.avatarUrl
  console.log(e, 'ee')
  const result = await uloadImg_()
  userInfo.value.userImage = e.detail.avatarUrl
  if (result.code == 200) {
    const res = await setApi({
      name: 'userinfo',
      param: [{ avatarUrl: result.imageUrl }],
      unLoading: true

    })
    console.log(res, 'res')
  }
})
</script>
<style scoped lang="scss">
@import "./indexs.scss";
</style>
